import java.util.Arrays;
import java.util.Scanner;

public class Java036 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("n,m:");
        int n=sc.nextInt();
        int m =sc.nextInt();
        int[] arr= new int[n];
        System.out.println("int[]:");
        for(int i=0;i<arr.length;i++){
            arr[i]=sc.nextInt();
        }
        fun(arr,m);
        System.out.println(Arrays.toString(arr));
    }
    public static void fun(int[] arr,int m){
        int[] arrcopy = arr.clone();
        int j=0;
        for(int i=m;i<arr.length;i++){
            arr[i]=arrcopy[j++];
        }
        j = arr.length-m;
        for(int i=0;i<m;i++){
            arr[i]=arrcopy[j++];
        }
    }
}
